from typing import  List
from sqlalchemy.orm import Mapped,relationship
from app.extensions import Base, INT_PK, STR_NOTNULL_UNIQUE_20

class Clas(Base):
    __tablename__= "clases"
    id: Mapped[INT_PK] # 主键id
    name:Mapped[STR_NOTNULL_UNIQUE_20]
    studentsList: Mapped[List["Student"]] = relationship(
      back_populates="clas", lazy=False)
    def  __repr__(self):
        return f"<Clas id:{self.id} name:{self.name}>"


if __name__ == '__main__':
    from app.extensions import engine
    Base.metadata.create_all(engine)